/**
 * Description
 *
 * Creation Date 27/12/2017
 * @author Candy
 */
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { is, fromJS} from 'immutable';
import Template from '../../component/Template';
import { getHomeBanner } from '../../api/index';
import HeaderNav from '../../component/HeaderNav';
import ProductList from '../../component/ProductList';

class Payment extends Component {
	constructor(props) {
		super(props);
		this.state = {
			isFetching: false,
			bannerList: []
		}
	}

	componentWillMount() {
		getHomeBanner().then(res => this.setState({ bannerList: res.data}))
	}

	componentWillUpdate(nextProps, nextState) {
		if(this.state !== nextState) {
			this.setState({isFetching: true})
		}
	}

	shouldComponentUpdate(nextProps, nextState) {
		if(nextState.isFetching) {
			return false;
		}
		return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state),fromJS(nextState))
	}

	render() {
		return (
			<div>
				<HeaderNav title="home" />product
				{/*<ProductList/>*/}
			</div>
		)
	}
}

export default Template({
	id: 'payment',
	component: Payment
});
